package com.example.loginproject.view.fragments

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.example.loginproject.databinding.FragmentPinLoginBinding
import com.example.loginproject.tool.MyLog
import com.example.loginproject.tool.navigateTo
import com.example.loginproject.user.UserManager


class PinLoginFragment : Fragment() {
    private lateinit var binding:FragmentPinLoginBinding
    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        binding = FragmentPinLoginBinding.inflate(inflater,null,false)
        return binding.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        //设置 切换到图案解锁的显示和隐藏
        /*
        if (UserManager.sharedInstance(requireContext()).hasUser()){
            binding.switchToPatternTextView.visibility = View.VISIBLE
        }else{
            binding.switchToPatternTextView.visibility = View.INVISIBLE
            binding.button.isEnabled = false //没有用户 无法点击登录按钮
        }
         */
        binding.switchToPatternTextView.setOnClickListener {
            navigateTo(PatternLoginFragment())
        }
    }
}